package com.lcx.db137.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lcx.db137.entity.Menu;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author lcx
 * @version 1.0
 * @Description
 * @date 2024/12/24 11:49
 */
public interface MenuMapper extends BaseMapper<Menu> {
    //根据用户id查询菜单
    @Select("select distinct(m.id), m.id,m.label,m.href,m.parentid,m.imgicon from userrole a inner join rolemenu r\n" +
            "on a.roleid=r.roleid  inner join menu m on r.menuid=m.id\n" +
            "where a.userid=#{userId}")
    List<Menu> selectMenuByUserId(@Param("userId") Integer userId);
}